/*
 Navicat Premium Data Transfer

 Source Server         : local
 Source Server Type    : MySQL
 Source Server Version : 80011
 Source Host           : localhost:3306
 Source Schema         : employee

 Target Server Type    : MySQL
 Target Server Version : 80011
 File Encoding         : 65001

 Date: 30/07/2020 19:23:02
*/

SET NAMES utf8mb4;
-- 在Mysql中取消外键约束
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for boy
-- ----------------------------
DROP TABLE IF EXISTS `boy`;
CREATE TABLE `boy` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of boy
-- ----------------------------
BEGIN;
INSERT INTO `boy` VALUES (1, '张无忌');
INSERT INTO `boy` VALUES (2, '许仙');
INSERT INTO `boy` VALUES (3, '杨过');
INSERT INTO `boy` VALUES (4, '段誉');
INSERT INTO `boy` VALUES (5, '令狐冲');
INSERT INTO `boy` VALUES (6, '韦小宝');
COMMIT;


-- ----------------------------
-- Table structure for girl
-- ----------------------------
DROP TABLE IF EXISTS `girl`;
CREATE TABLE `girl` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(50) NOT NULL,
  `sex` char(1) DEFAULT '女',
  `borndate` datetime DEFAULT '1987-01-01 00:00:00',
  `phone` varchar(11) NOT NULL,
  `photo` blob,
  `boyfriend_id` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `g_b_fk` (`boyfriend_id`),
  CONSTRAINT `g_b_fk` FOREIGN KEY (`boyfriend_id`) REFERENCES `boy` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of girl
-- ----------------------------
BEGIN;
INSERT INTO `girl` VALUES (1, '东方不败', '女', '1988-02-03 00:00:00', '18209876577', NULL, 5);
INSERT INTO `girl` VALUES (2, '建宁公主', '女', '1987-12-30 00:00:00', '18219876577', NULL, 6);
INSERT INTO `girl` VALUES (3, '小龙女', '女', '1989-02-03 00:00:00', '18209876567', NULL, 3);
INSERT INTO `girl` VALUES (4, '木婉清', '女', '1993-02-03 00:00:00', '18209876579', NULL, 4);
INSERT INTO `girl` VALUES (5, '任盈盈', '女', '1992-02-03 00:00:00', '18209179577', NULL, 5);
INSERT INTO `girl` VALUES (6, '周芷若', '女', '1988-02-03 00:00:00', '18209876577', NULL, 1);
INSERT INTO `girl` VALUES (7, '岳灵珊', '女', '1987-12-30 00:00:00', '18219876577', NULL, 5);
INSERT INTO `girl` VALUES (8, '小昭', '女', '1989-02-03 00:00:00', '18209876567', NULL, 1);
INSERT INTO `girl` VALUES (9, '双儿', '女', '1993-02-03 00:00:00', '18209876579', NULL, 6);
INSERT INTO `girl` VALUES (10, '王语嫣', '女', '1992-02-03 00:00:00', '18209179577', NULL, 4);
INSERT INTO `girl` VALUES (11, '白素贞', '女', '1993-02-03 00:00:00', '18209876579', NULL, 2);
INSERT INTO `girl` VALUES (12, '赵敏', '女', '1992-02-03 00:00:00', '18209179577', NULL, 1);
COMMIT;

-- 在建表和插入数据之后，再设置外键约束
SET FOREIGN_KEY_CHECKS = 1;
